package com.chezhujie.www.service;

import com.chezhujie.www.domain.Czjrefundvideo;
import com.chezhujie.www.persistence.CzjrefundvideoMapper;
import com.sys.core.exception.ClassCheckException;
import com.sys.user.base.service.BaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


/**
 * 退款附加视频
 * Created by 汤伟杰 on 2017/5/23.
 */
@Service
public class CzjrefundvideoService extends BaseService<Czjrefundvideo> {
    @Autowired
    private CzjrefundvideoMapper czjrefundvideoMapper;

    @Autowired
    public void setBaseMapper(CzjrefundvideoMapper czjrefundvideoMapper) {
        this.baseMapper = czjrefundvideoMapper;
    }


    public void checkEntity(Czjrefundvideo czjrefundvideo) throws ClassCheckException {
        if(czjrefundvideo.getRefundimageId()!=null&&czjrefundvideo.getRefundimageId().length()>19){
            throw new ClassCheckException("退款附加视频主键不能超过19个字符");
        }
        if(czjrefundvideo.getVidPath()!=null&&czjrefundvideo.getVidPath().length()>200){
            throw new ClassCheckException("退款附加视频视频地址不能超过200个字符");
        }
        if(czjrefundvideo.getRefundId()!=null&&czjrefundvideo.getRefundId().length()>19){
            throw new ClassCheckException("退款附加视频退回id不能超过19个字符");
        }
    }
    public void checkListEntity(List<Czjrefundvideo> listCzjrefundvideo) throws ClassCheckException {

        for (Czjrefundvideo czjrefundvideo : listCzjrefundvideo) {
            checkEntity(czjrefundvideo);
        }

    }
}
